package com.tudouji.project.noticeinfo.service.impl;

import java.util.List;

import com.flow.service.mapper.IFlowTaskDetailMapper;
import com.flow.service.pojo.flow.FlowTaskDetail;
import com.flow.service.process.service.impl.FlowTaskDetailServiceImpl;
import com.tudouji.common.utils.SecurityUtils;
import com.tudouji.common.utils.StringUtils;
import com.tudouji.project.system.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tudouji.project.noticeinfo.mapper.NoticeinfoMapper;
import com.tudouji.project.noticeinfo.domain.Noticeinfo;
import com.tudouji.project.noticeinfo.service.INoticeinfoService;

/**
 * 通知记录Service业务层处理
 * 
 * @author tudouji
 * @date 2021-04-13
 */
@Service
public class    NoticeinfoServiceImpl implements INoticeinfoService
{
    @Autowired
    private NoticeinfoMapper noticeinfoMapper;
    @Autowired
    private IFlowTaskDetailMapper flowTaskDetailMapper;

    /**
     * 查询通知记录
     * 
     * @param autoid 通知记录ID
     * @return 通知记录
     */
    @Override
    public Noticeinfo selectNoticeinfoById(Long autoid)
    {
        return noticeinfoMapper.selectNoticeinfoById(autoid);
    }

    /**
     * 查询通知记录列表
     * 
     * @param noticeinfo 通知记录
     * @return 通知记录
     */
    @Override
    public List<Noticeinfo> selectNoticeinfoList(Noticeinfo noticeinfo)
    {
        return noticeinfoMapper.selectNoticeinfoList(noticeinfo);
    }

    /**
     * 新增通知记录
     * 
     * @param noticeinfo 通知记录
     * @return 结果
     */
    @Override
    public int insertNoticeinfo(Noticeinfo noticeinfo)
    {
        return noticeinfoMapper.insertNoticeinfo(noticeinfo);
    }

    /**
     * 修改通知记录
     * 
     * @param noticeinfo 通知记录
     * @return 结果
     */
    @Override
    public int updateNoticeinfo(Noticeinfo noticeinfo)
    {
        return noticeinfoMapper.updateNoticeinfo(noticeinfo);
    }

    /**
     * 批量删除通知记录
     * 
     * @param autoids 需要删除的通知记录ID
     * @return 结果
     */
    @Override
    public int deleteNoticeinfoByIds(Long[] autoids)
    {
        return noticeinfoMapper.deleteNoticeinfoByIds(autoids);
    }

    /**
     * 删除通知记录信息
     * 
     * @param autoid 通知记录ID
     * @return 结果
     */
    @Override
    public int deleteNoticeinfoById(Long autoid)
    {
        return noticeinfoMapper.deleteNoticeinfoById(autoid);
    }

	/*@Override
	public List<Noticeinfo> selectNotHandleList(Noticeinfo noticeinfo) {
		// Auto-generated method stub
		return noticeinfoMapper.selectNotHandleList(noticeinfo);
	}*/

  /*  public List<Noticeinfo> selectNuHandleInfo(String userId) {
        Long userid;
        if(StringUtils.isBlank(userId)){
            SysUser user=SecurityUtils.getLoginUser().getUser();
            userid=user.getUserId();
        }else{
            userid=Long.parseLong(userId);
        }
        return noticeinfoMapper.selectNuHandleInfo(userid);
    }*/

    @Override
    public List<FlowTaskDetail> selectNuHandleInfo(String userId) {
        Long userid;
        if(StringUtils.isBlank(userId)){
            SysUser user=SecurityUtils.getLoginUser().getUser();
            userid=user.getUserId();
        }else{
            userid=Long.parseLong(userId);
        }
        FlowTaskDetail detail=new FlowTaskDetail();
        detail.setRecieverId(userid);
        return flowTaskDetailMapper.selectNuHandleInfo(detail);
    }

    @Override
    public List<FlowTaskDetail> selectNuHandleInfo(String userId,Long flowId) {
        FlowTaskDetail detail=new FlowTaskDetail();
        Long userid;
        if(StringUtils.isBlank(userId)){
            SysUser user=SecurityUtils.getLoginUser().getUser();
            userid=user.getUserId();
        }else{
            userid=Long.parseLong(userId);
        }
        detail.setRecieverId(userid);
        detail.setFlowTempId(flowId);
        return flowTaskDetailMapper.selectNuHandleInfo(detail);
    }
}
